﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Markup;
using UIT.Sl.Xaml;

namespace UIT.Controls.Template
{
	[ContentProperty("VisualTree")]
	public class TemplateContent
	{
		string template;

		public IControl VisualTree { get; set; }

		public IControl CreateInstance()
		{
			if (string.IsNullOrEmpty(template))
				template = XamlXmlWriter.WriteObject(VisualTree);

			return (IControl)XamlReader.Load(template);
		}
	}
}
